import request from "@/utils/request"
const BASE_URL = process.env.VUE_APP_BASE_URL_OA

/**
 * 我下属的任务列表
 * @param {*} data
 */
export function taskListAPI(data) {
	return request({
		url: BASE_URL + "oaTask/queryTaskList",
		method: "post",
		data: data,
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}

/**
 * 新增任务
 * @param {*} data
 */
export function setTaskAPI(data) {
	return request({
		url: BASE_URL + "workTask/saveWorkTask",
		method: "post",
		data: data,
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}

// /**
//  * 删除任务
//  * @param {*} data
//  */
// export function deleteTaskAPI(data) {
//   return request({
//     url: BASE_URL +  'task/deleteTask',
//     method: 'post',
//     data: data
//   })
// }

/**
 * 任务详情
 * @param {*} data
 */
export function detailsTaskAPI(data) {
	return request({
		url: BASE_URL + `workTask/queryTaskInfo/${data.taskId}`,
		method: "post"
	})
}

/**
 * 回收站任务详情
 * @param {*} data
 */
export function detailsTrashTaskAPI(data) {
	return request({
		url: BASE_URL + "workTask/queryTrashTaskInfo",
		method: "post",
		data: data
	})
}

/**
 * 任务活动
 * @param {*} data
 */
export function queryLogTaskAPI(data) {
	return request({
		url: BASE_URL + `workTaskLog/queryTaskLog/${data.taskId}`,
		method: "post"
	})
}

/**
 * 编辑相关信息
 * @param {*} data
 */
export function editTaskRelationAPI(data) {
	return request({
		url: BASE_URL + "workTaskRelation/saveWorkTaskRelation",
		method: "post",
		data: data,
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}

/**
 * 取消选择的标签 taskId  label
 * @param {*} data
 */
export function taskDeleteLabelAPI(data) {
	return request({
		url: BASE_URL + "oaTask/deleteWorkTaskLabel",
		method: "post",
		data: data,
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}

/**
 * 办公任务导出
 * @param {*} data
 */
export function taskOaExportAPI(data) {
	return request({
		url: BASE_URL + "oaTask/oaTaskExport",
		method: "post",
		data: data,
		responseType: "blob",
		headers: {
			"Content-Type": "application/json;charset=UTF-8"
		}
	})
}
